const OSS = require('ali-oss')

exports.init = function (ossConfig = {}) {
  const client =  new OSS(ossConfig)

  put = async (buffer, filename, uploadPath = 'uploads/') => {
    try {
      const result = await client.put(uploadPath + filename, buffer)
      return  result
    } catch (err) {
      throw new Error(err)
    }
  }

  return {
      put
  }
}




